home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 52
/
Amiga Format AFCD52 (Issue 136, May 2000).iso
/
-serious-
/
programming
/
basic
/
mildred
/
mildred.lha
/
lha
/
LandTest4.lha
/
LandTest4.ascii
< prev
next >
Wrap
Text File
|
1999-05-11
|
7KB
|
277 lines
WBStartup
#Width=320
#Height=240
MCPU Processor
Mc2pCPUmode Processor
Pic$="5Ms2.IFF"
Land$="Land17.iff"
sky$="sky10.iff"
#Objects=25 ;55;150;280;400
#ObjWidth=128 ;64;32;16;8
#ObjHeight=64 ;64;32;16;8
#StarsPerSpeed=15
MReserveShapes 500
InitBank 0,2880*60,$10002
CludgeBitMap 0,2880,60,8,Bank(0)
InitPalette 0,256
LoadBitMap 0,Land$,0
MReserveBitmaps 3
MBitmap 0,2880,60
MPlanar16ToBitmap 0,Bank(0)
MCludgeShape 0,16,27,MBitmapPtr(1120,0)
MBitmap 2,#Width,150
MBitmap 1,#Width+128,#Height+128
InitBank 0,#Width*#Height,$10002
CludgeBitMap 0,#Width,#Height,8,Bank(0)
Screen 0,0,0,#Width,#Height,8,0,"",0,0,0
Window 0,0,0,#Width,#Height,$100,"back",0,0
InitShape 0,16,1,2
WPointer 0
Menus Off
InitPalette 1,256
LoadBitMap 0,Pic$,1
For c=64+64+64 To 255
CopyColour 0,1,c,c
Next c
MReservec2pWindows 1
Mc2pWindow 0,#Width,#Height,#Width+128,#Width,#Height
s=1
For y=0 To 63 Step #ObjHeight
For x=0 To 127 Step #ObjWidth
If MShape(s,#ObjWidth,#ObjHeight)=0 Then End
For yy=y To y+#ObjHeight-1
For xx=x To x+#ObjWidth-1
MPlotShape xx MOD #ObjWidth, yy MOD #ObjHeight, Point(xx,yy)
Next xx
Next yy
MMakeCookie s
s+1
Next x
Next y
Cls 0
LoadBitMap 0,sky$,0
For c=0 To 63
CopyColour 0,1,c,c
Next c
MPlanar16ToBitmap 2,Bank(0),#Width,150,#Width,#Height
NumberOfShapes.w=s-1
ShowPalette 1
NEWTYPE.xy
x.w
y.w
End NEWTYPE
Dim pos.xy(#Objects)
Dim pos2.xy(#Objects)
Dim direction.xy(#Objects)
For obj=1 To #Objects
pos(obj)\x=Rnd(2220-36)+16
pos(obj)\y=Rnd(#Height-100-32)+16+13
Repeat
direction(obj)\x=Rnd(8)-4
Until direction(obj)\x<>0
direction(obj)\y=Rnd(6)-3
Next obj
NEWTYPE.xyq
x.q
y.q
End NEWTYPE
Dim star1.xyq(#StarsPerSpeed)
Dim star2.xyq(#StarsPerSpeed)
Dim star3.xyq(#StarsPerSpeed)
Dim star4.xyq(#StarsPerSpeed)
Dim star5.xyq(#StarsPerSpeed)
For s=1 To #StarsPerSpeed
star1(s)\x=Rnd(319)
star1(s)\y=Rnd(120)
star2(s)\x=Rnd(319)
star2(s)\y=Rnd(100)
star3(s)\x=Rnd(319)
star3(s)\y=Rnd(80)
star4(s)\x=Rnd(319)
star4(s)\y=Rnd(60)
star5(s)\x=Rnd(319)
star5(s)\y=Rnd(40)
Next s
speedsetting.q=1 ; Global speed multiplier
xpos.q=0
xaccelerate.q=1*speedsetting
xmomentum.q=0
xairresistance.q=0;.1*speedsetting
xmaxspeed.q=16*speedsetting
ypos.q=(#Height-69)/2
yaccelerate.q=1;*speedsetting
ymomentum.q=0
ymaxspeed.q=8*speedsetting
ytopdampen.q=1.9
ybottomdampen.q=1.65
ygravity.q=0.15;*speedsetting
NEWTYPE.OffsetList
LineWidth.w
X1Offset.w
X2Offset.w
ModuloOffset.w
End NEWTYPE
Dim rows.OffsetList(47)
Dim rowsq.q(47)
cnt.l=0
MParticleFormat 0
MBitmapOrigin 1,64,64
MBitmapWrap 1,On
intcnt=0
SetInt 5
intcnt+1
End SetInt
ResetTimer
While Joyb(1)=0
jh=JHoriz(1)
jv=JVert(1)
xmomentum+(xaccelerate*jh)
ymomentum+(yaccelerate*jv)
ymomentum+ygravity
If xmomentum>0
xmomentum-xairresistance
If xmomentum<0 Then xmomentum=0
Else
xmomentum+xairresistance
If xmomentum>0 Then xmomentum=0
EndIf
If xmomentum>xmaxspeed Then xmomentum=xmaxspeed
If xmomentum<-xmaxspeed Then xmomentum=-xmaxspeed
If ymomentum>ymaxspeed Then ymomentum=ymaxspeed
If ymomentum<-ymaxspeed Then ymomentum=-ymaxspeed
xpos+xmomentum
ypos+ymomentum
If ypos<0
ymomentum=-ymomentum/ytopdampen
ypos=0
EndIf
If ypos>#Height-40-26
ymomentum=-ymomentum/ybottomdampen
ypos=#Height-40-26
EndIf
If xpos<0 Then xpos+2240
If xpos>=2240 Then xpos-2240
cnt+1
; MBitmapClip 1,0,0,#Width,#Height-60-14-26,On
; MCls 0
MBlockScroll 0,0,#Width,#Height-60-32,0,0,2
c=193
For yy=#Height-61-26-14 To #Height-61-26
MBoxF 0,yy,319,yy,c
c+1
Next yy
xx.q=xpos/7
For b=1 To 8
MBoxF 320-xx,#Height-62-26,320-xx+3,#Height-61-26,220
xx+40
If xx>319 Then xx-320
Next b
MAddXYToParticlesQ &star1(1)\x,#StarsPerSpeed,-(xmomentum/60),0
MAddXYToParticlesQ &star2(1)\x,#StarsPerSpeed,-(xmomentum/50),0
MAddXYToParticlesQ &star3(1)\x,#StarsPerSpeed,-(xmomentum/40),0
MAddXYToParticlesQ &star4(1)\x,#StarsPerSpeed,-(xmomentum/30),0
MAddXYToParticlesQ &star5(1)\x,#StarsPerSpeed,-(xmomentum/20),0
MParticleFormat -1
MBitmapClip 1,On
MWrapXParticles &star1(1)\x,#StarsPerSpeed
MWrapXParticles &star2(1)\x,#StarsPerSpeed
MWrapXParticles &star3(1)\x,#StarsPerSpeed
MWrapXParticles &star4(1)\x,#StarsPerSpeed
MWrapXParticles &star5(1)\x,#StarsPerSpeed
MBitmapClip 1,Off
MPlotParticles &star1(1)\x,#StarsPerSpeed,192+14-Rnd(12)
MPlotParticles &star2(1)\x,#StarsPerSpeed,192+20-Rnd(12)
MPlotParticles &star3(1)\x,#StarsPerSpeed,192+26-Rnd(12)
MPlotParticles &star4(1)\x,#StarsPerSpeed,192+32-Rnd(12)
MPlotParticles &star5(1)\x,#StarsPerSpeed,192+38-Rnd(12)
MParticleFormat 0
MScroll 160+xpos,47,#Width,13,0,#Height-13-26,0
mult.q=1.0
width.q=2240
widthadd.q=(2240-320)/47
For yy=46 To 0 Step -1
rowsq(yy)=1280-(width LSR 1)+(xpos*mult) ; 1280=1120+320-160
width-widthadd
mult-0.01825
;mult=width/2240
Next yy
rows(0)\LineWidth=320,Int(rowsq(0)),0,0
For yy=1 To 46
rows(yy)\LineWidth=320,Int(rowsq(yy))-Int(rowsq(yy-1)),0,0
Next yy
MScroll 0,0,320,47,0,#Height-60-26,0,&rows(0)\LineWidth
MBitmapClip 1,20,#Height-26-6,#Width-40,26,On
MCls 192
MBitmapClip 1,Off
MBoxF 139,#Height-26-6,180,#Height-1-6,205
MBox 138,#Height-26-6,180,#Height-1-6,210
MScroll 160+xpos+20,47,320-40,6,20,#Height-6,0
MAddToParticles &pos(1)\x,#Objects,&direction(1)\x
For obj=1 To #Objects
If pos(obj)\x<0 Then pos(obj)\x+2240
If pos(obj)\x>=2240 Then pos(obj)\x-2240
If pos(obj)\y<8 OR pos(obj)\y>#Height-16-#ObjHeight-26 Then direction(obj)\y=-direction(obj)\y
Next obj
For obj=1 To #Objects
pos2(obj)\x=pos(obj)\x LSR 3
pos2(obj)\y=#Height-26-6+(pos(obj)\y LSR 3)
Next obj
MAddXYToParticles &pos2(1)\x,#Objects,320-(xpos LSR 3)-180,0
MBitmapClip 1,20,0,#Width-40,#Height,On
MWrapXParticles &pos2(1)\x,#Objects
MBitmapClip 1,Off
; MPlotParticles &pos2(1)\x,#Objects,255
ww=(#ObjWidth LSR 3)-1
hh=(#ObjHeight LSR 3)-1
; MDrawingMode MAddMode
For p=1 To #Objects
; MBoxF pos2(p)\x,pos2(p)\y,pos2(p)\x+ww,pos2(p)\y+hh,15
MZoomShapeToBitmap 3,3,7,7,pos2(p)\x,pos2(p)\y,ww,hh,False,(p MOD NumberOfShapes)+1
Next p
; MDrawingMode MColourMode
MScroll 160+xpos,47,20,13,0,#Height-26,0
MScroll 160+xpos,47,20,13,0,#Height-13,0
MScroll 160+xpos+300,47,20,13,300,#Height-26,0
MScroll 160+xpos+300,47,20,13,300,#Height-13,0
MPlot 160,#Height-25-6+(ypos LSR 3),40
MPlot 160,#Height-24-6+(ypos LSR 3),40
For obj=1 To #Objects
If pos(obj)\x>xpos-#ObjWidth AND pos(obj)\x<xpos+#Width;-#ObjWidth+#ObjWidth
MBlit (obj MOD NumberOfShapes)+1,pos(obj)\x-xpos,pos(obj)\y
EndIf
Next obj
MBlit 0,152,ypos
Mc2p Bank(0)
; If intcnt<=2 Then VWait Else intcnt=0 ; only wait for 25fps if faster
Wend
t=Timer
a.q=50.0/(t/cnt)
NPrint a
VWait 30
Repeat:Until Joyb(0)<>0 OR Joyb(1)<>0
End